{extend name="common@base/common" /}
{block name="header"}
{/block}

{block name="body"}

<section>
	<div class="span12 tab-content" style="margin:30px auto; padding:30px 50px; width:600px;">
         <h4 class="mb-4 text-center">修改密码</h4>
        <form class="login-form" action="__SELF__" method="post">
          <div class="form-group row">
            <label class="col-sm-3 text-right">原密码</label>
            <div class="col-sm-9">
              <input class="form-control" style="max-width:100%" type="password"  class="span3" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="old">
            </div>
          </div>
          <div class="form-group row">
            <label class="col-sm-3 text-right">新密码</label>
            <div class="col-sm-9">
              <input class="form-control" style="max-width:100%" type="password"  class="span3" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">
            </div>
          </div>
          <div class="form-group row">
            <label class="col-sm-3 text-right">确认密码</label>
            <div class="col-sm-9">
              <input class="form-control" style="max-width:100%" type="password" class="span3" placeholder="请再次输入密码" recheck="password" errormsg="您两次输入的密码不一致" nullmsg="请填确认密码" datatype="*" name="repassword">
            </div>
            <div class="col-sm-9 Validform_checktip text-warning"></div>
          </div>
          <div class="form-group row">
            <div class="col-sm-4 offset-sm-4">
              <button type="submit" class="btn submit-btn">提 交</button>
            </div>
          </div>
        </form>
	</div>
</section>
{/block}

{block name="side"}{/block}
{block name="script"}
	<script type="text/javascript">

    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").addClass("log-in").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").removeClass("log-in").attr("disabled", false);
	    	});
    	$("form").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"), self.serialize(), success, "json");
    		return false;

    		function success(data){
    			if(data.code==0){
    				//$.Dialog.success('修改密码成功！');
    				alert('修改密码成功！');
    				window.location.href = data.url;
    			} else {
    				self.find(".Validform_checktip").text(data.msg);
    			}
    		}
    	});
	</script>
{/block}
